import re

def requirement_deal(str):
    resultList = ['', '','']
    list = str.split('|')
    if len(list)>=5:
        resultList[0] = list[1].replace(" ","").strip()
        resultList[1] = list[2].replace(" ","").strip()
        resultList[2] = list[3].replace(" ","").strip()
    else:
        resultList[0]= str
    return resultList

def salary_deal(str):
    resultList = ['','']
    if str.find("/月")!= -1:
        newstr = str.replace("/月", "")
        if newstr.find("千") != -1:
            newstr = newstr.replace("千", "")
            if newstr.find("-") != -1:
                list =  newstr.split("-")
                resultList[0] = float(list[0])*1000
                resultList[1] = float(list[1]) * 1000
            else:
                resultList[0] = float(newstr)*1000
                resultList[1] = float(newstr) * 1000
        elif newstr.find("万") != -1:
            newstr = newstr.replace("万", "")
            if newstr.find("-") != -1:
                list = newstr.split("-")
                resultList[0] = float(list[0]) * 10000
                resultList[1] = float(list[1]) * 10000
            else:
                resultList[0] = float(newstr) * 10000
                resultList[1] = float(newstr) * 10000
        else:
            resultList[0] = str
    elif str.find("/年")!= -1:
        newstr = str.replace("/年", "")
        if newstr.find("千") != -1:
            newstr = newstr.replace("千", "")
            if newstr.find("-") != -1:
                list = newstr.split("-")
                resultList[0] = int(float(list[0]) * 1000/12)
                resultList[1] = int(float(list[1]) * 1000/12)
            else:
                resultList[0] = int(float(newstr) * 1000/12)
                resultList[1] = int(float(newstr) * 1000/12)
        elif newstr.find("万") != -1:
            newstr = newstr.replace("万", "")
            if newstr.find("-") != -1:
                list = newstr.split("-")
                resultList[0] = int(float(list[0]) * 10000/12)
                resultList[1] = int(float(list[1]) * 10000/12)
            else:
                resultList[0] = int(float(newstr) * 10000/12)
                resultList[1] = int(float(newstr) * 10000/12)
        else:
            resultList[0] = str
    else:
        resultList[0] = str

    return resultList

#处理城市 区域
def area_deal(str):
    strlist = str.split('-')
    if len(strlist)==2:
        return strlist
    else:
        return [str,'']

#处理公司详情
def introduction_deal(str):
    result=['','','']
    strlist = str.split('|')
    if len(strlist)==3:
        result[0]=strlist[0].strip()
        result[1] = strlist[1].strip()
        result[2] = strlist[2].strip()
        pass
    else:
        result[0] = strlist
    return result

#处理公司地址
def companyAdress_deal(str):
    if str=='':
        return str
    else:
        str=str.replace('\r','').replace('\n','')
        strlist = re.findall(".*</span>(.*)</p>.*", str)
        return strlist[0].replace(' ','')


if __name__ == '__main__':
    companyAdress_deal('民营公司  |  50-150人  |  计算机软件 计算机服务(系统、数据服务、维修)')